import com.dao.ManagerDao;
import com.pojo.Manager;
import com.util.MyBatisUtil;
import org.junit.Test;

import java.util.List;

public class MyBatisDynamicsql {

    @Test
    public void selectAll(){
        ManagerDao mapper = MyBatisUtil.getMapper(ManagerDao.class);

        List<Manager> managers = mapper.selectAll();

        for (Manager manager : managers) {
            System.out.println(manager);
        }
    }

    @Test
    public void selectByCondition(){
        ManagerDao mapper = MyBatisUtil.getMapper(ManagerDao.class);

        Manager manager = mapper.selectByCondition(2);

        System.out.println(manager);
    }

    @Test
    public void updateByCondition(){
        ManagerDao mapper = MyBatisUtil.getMapper(ManagerDao.class);

        Manager manager = mapper.updateByCondition(1);
        manager.setMgrId(1001);
        manager.setMgrName("赵六");
        manager.setMgrPassword(123);

        System.out.println(manager);
    }
}
